Announcement

Collapse
No announcement yet.

difference between using the: if(bInit == false){} & nState

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • difference between using the: if(bInit == false){} & nState

    Hi,

    Is there a difference between using the: if(bInit == false){}
    vs using the if (nState == BARSTATE_ALLBARS) { }
    as I understand it both are limited to "the bars are being loaded by the script".
    Thank you for any help.

    Wayne

  • #2
    Re: difference between using the: if(bInit == false){} & nState

    Wayne
    Yes there is. See my reply and example posted in this thread
    Alex


    Originally posted by waynecd
    Hi,

    Is there a difference between using the: if(bInit == false){}
    vs using the if (nState == BARSTATE_ALLBARS) { }
    as I understand it both are limited to "the bars are being loaded by the script".
    Thank you for any help.

    Wayne

    Comment


    • #3
      Thanks Alex,

      I'll study your sample script. I am trying to reduce eSignal lag by programming more efficiently and eliminating redundant/unnecessary calculations.

      It seems that BARSTATE_ALLBARS may be more efficient since it doesn't compound at each refresh. (not sure I know what that implies yet but it will likely be more clear once I study your example.

      Thanks again.

      Wayne

      Comment


      • #4
        Hi Alex,

        1. Does a study initialized in the bInit routine compound when the chart is refreshed via Ctrl+OK or only if it has a sum statement like the "Counter++" statement in your example?

        2. When if ever is it appropriate to initilize a study (built-in or custom) within the "if(getBarState()==BARSTATE_ALLBARS){" statement as opposed to the bInit routine?

        3. Do you have a link to tutorial 5 (Accessing Chart Data). It is referenced at the end of Tutorial 4?

        Thanks Alex, help from the forums make a huge difference.

        Wayne

        Comment


        • #5
          Wayne

          1. Does a study initialized in the bInit routine compound when the chart is refreshed via Ctrl+OK or only if it has a sum statement like the "Counter++" statement in your example?

          2. When if ever is it appropriate to initilize a study (built-in or custom) within the "if(getBarState()==BARSTATE_ALLBARS){" statement as opposed to the bInit routine?
          Again review the post I linked in my previous reply

          3. Do you have a link to tutorial 5 (Accessing Chart Data). It is referenced at the end of Tutorial 4?
          To my knowledge Tutorial 5 does not exist. As a matter of fact I believe that the reference you mention was removed from a subsequent revision of Tutorial 4
          Alex

          Comment

          Working...
          X